Skip to content

Conversation

@HerrCai0907
Copy link
Contributor

Under previous test setup, the test result will be influenced by clang-tidy file in parent folder (between llvm-projects root and build folder). It is inconventient and leads some confusion.
This PR wants to ensure sandbox to avoid outside's clang-tidy influenece test result.

Under previous test setup, the test result will be influenced by clang-tidy file in parent folder (between llvm-projects root and build folder). It is inconventient and leads some confusion.
This PR wants to ensure sandbox to avoid outside's clang-tidy influenece test result.
@llvmbot
Copy link
Member

llvmbot commented May 25, 2025

@llvm/pr-subscribers-clangd

@llvm/pr-subscribers-clang-tools-extra

Author: Congcong Cai (HerrCai0907)

Changes

Under previous test setup, the test result will be influenced by clang-tidy file in parent folder (between llvm-projects root and build folder). It is inconventient and leads some confusion.
This PR wants to ensure sandbox to avoid outside's clang-tidy influenece test result.


Full diff: https://github.com/llvm/llvm-project/pull/141410.diff

2 Files Affected:

  • (added) clang-tools-extra/clangd/test/Inputs/path-mappings/server/.clang-tidy (+1)
  • (modified) clang-tools-extra/clangd/test/system-include-extractor.test (+3)
diff --git a/clang-tools-extra/clangd/test/Inputs/path-mappings/server/.clang-tidy b/clang-tools-extra/clangd/test/Inputs/path-mappings/server/.clang-tidy
new file mode 100644
index 0000000000000..1f16f2a33b3ce
--- /dev/null
+++ b/clang-tools-extra/clangd/test/Inputs/path-mappings/server/.clang-tidy
@@ -0,0 +1 @@
+InheritParentConfig: false
\ No newline at end of file
diff --git a/clang-tools-extra/clangd/test/system-include-extractor.test b/clang-tools-extra/clangd/test/system-include-extractor.test
index 4ccc093671324..372b4a1a0fef5 100644
--- a/clang-tools-extra/clangd/test/system-include-extractor.test
+++ b/clang-tools-extra/clangd/test/system-include-extractor.test
@@ -32,6 +32,9 @@
 # RUN: echo 'printf "End of search list.\r\n" >&2' >> %t.dir/bin/my_driver.sh
 # RUN: chmod +x %t.dir/bin/my_driver.sh
 
+# Create fake clang-tidy config to ensure sandbox
+# RUN: echo 'InheritParentConfig: false' >> %t.dir/.clang-tidy
+
 # Create header files my/dir/a.h and my/dir2/b.h
 # RUN: mkdir -p %t.dir/my/dir
 # RUN: touch %t.dir/my/dir/a.h

# RUN: chmod +x %t.dir/bin/my_driver.sh

# Create fake clang-tidy config to ensure sandbox
# RUN: echo 'InheritParentConfig: false' >> %t.dir/.clang-tidy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of this can you just pass -clang-tidy=0 to clangd invocations in this file? we shouldn't be testing/relying on any clang-tidy behavior in this test file.

@@ -0,0 +1 @@
InheritParentConfig: false No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we running any tests in this directory? these inputs are usually copied to temp test directories, since you're not copying this over in any of the tests, is this really needed? (or do we have some tests that recursively copy everything?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

path-mapping will copy all folder to tmp folder. but i agree disable clangtidy is better

@HerrCai0907 HerrCai0907 requested a review from kadircet May 26, 2025 14:40
@HerrCai0907 HerrCai0907 merged commit f1d8e37 into llvm:main May 26, 2025
11 checks passed
@HerrCai0907 HerrCai0907 deleted the ensure-sandbox-clangd-test branch May 26, 2025 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants